package com.moji.controller.api;


import com.moji.common.base.ApiResult;
import com.moji.entity.MjAboutUs;
import com.moji.entity.MjSupportHelp;
import com.moji.entity.dto.QuerySupportHelpDto;
import com.moji.service.MjSupportHelpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 支持与帮助表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-07-20
 */
@RestController
@RequestMapping("/api/mjSupportHelp")
@Api(tags = "支持与帮助api相关接口", value = "支持与帮助api相关接口")
public class MjSupportHelpController {

    @Resource
    private MjSupportHelpService mjSupportHelpService;

    @PostMapping("/queryByPage")
    @ApiOperation(value = "支持与帮助_分页查询",response = MjSupportHelp.class)
    public ApiResult queryByPage(@RequestBody QuerySupportHelpDto dto){
        return ApiResult.ok(mjSupportHelpService.queryByPage(dto));
    }

    @PostMapping("/detail")
    @ApiOperation(value = "支持与帮助_详情",response = MjSupportHelp.class)
    public ApiResult detail(@RequestParam("id") Long id){
        return ApiResult.ok(mjSupportHelpService.detail(id));
    }

    @PostMapping("/add")
    @ApiOperation(value = "支持与帮助_新增",response = Boolean.class)
    public ApiResult add(@Validated @RequestBody MjSupportHelp mjSupportHelp){
        return ApiResult.ok(mjSupportHelpService.add(mjSupportHelp));
    }

    @PostMapping("/edit")
    @ApiOperation(value = "支持与帮助_编辑",response = Boolean.class)
    public ApiResult edit(@Validated @RequestBody MjSupportHelp mjSupportHelp){
        return ApiResult.ok(mjSupportHelpService.edit(mjSupportHelp));
    }

    @GetMapping("/delete")
    @ApiOperation(value = "支持与帮助_删除",response = Boolean.class)
    public ApiResult delete(@RequestParam("id") Long id){
        return ApiResult.ok(mjSupportHelpService.delete(id));
    }

    @GetMapping("/prOnOff")
    @ApiOperation(value = "支持与帮助_启用禁用",response = Boolean.class)
    public ApiResult prOnOff(@RequestParam("id") Long id,@RequestParam("prOnOff") String prOnOff){
        return ApiResult.ok(mjSupportHelpService.prOnOff(id,prOnOff));
    }

}

